/*
 *  Copyright (c) 2014 ZengYajian
 *
 *  Simple http protocol parser module.
 *  by ZengYajian
 */

#ifndef __http_h__
#define __http_h__

#define _VERSION_1_1	(101)
#define _VERSION_1_0	(100)

enum request_type {
	REQUEST_GET,
	REQUEST_POST,
	REQUEST_UNKNOW,
};

enum connection {
	CLOSE,
	KEEP_ALIVE,
};

struct http_request_t {
	enum request_type type;
	enum connection state;
	int version;
	char *res;
	char *host;
};

struct http_request_t *http_request_alloc(enum request_type type);
void http_request_free(struct http_request_t *r);
enum request_type http_content_parse(char *content, int size, struct http_request_t *r);

#endif
